#ifndef PAINTPOUMIAN_H
#define PAINTPOUMIAN_H


#include <QWidget>
#include <QMap>
#include <QPixmap>
#include <QVector>
#include <QWidget>
#include <QPushButton>
#include <QTextEdit>
#include <QLabel>
#include "QPushButton"
#include "datatype/segy.h"
#include "QFileDialog"
#include "plotsettings.h"
#include "QComboBox"
#include "form/segyproperdialog.h"
#include "thread/segythread.h"
#include  "QStylePainter"
#include "QSettings"
#include "QRect"
#include "QMouseEvent"
class QToolButton;
class PlotSettings;

namespace Ui {
class PaintPoumian;
}

class PaintPoumian : public QWidget
{
    Q_OBJECT

public:
    explicit PaintPoumian(QWidget *parent = 0);
    ~PaintPoumian();
    void drawGrid(QPainter *painter);
    void drawCurves(QPainter *painter);
    void refreshPixmap();

    void drawXTick(QPainter *painter);
    void drawYTick(QPainter *painter);
    bool isXTickValid(QPointF pos);
    void mousePressEvent(QMouseEvent *event);
    bool isValid(QPointF pos);
    bool isYTickValid(QPointF pos);
    void readData();
    bool isReadData();
    void mouseReleaseEvent(QMouseEvent *event);
    void refreshMousePixmap();
protected:
    void mouseMoveEvent(QMouseEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
    void keyPressEvent(QKeyEvent *event);
    void paintEvent(QPaintEvent *event);
    QSize minimumSizeHint() const;
    QSize sizeHint() const;
private slots:
    void on_pushButton_File_clicked();
    void allFinish();
    void on_slider_Acc_valueChanged(int value);

signals:
    void getData();

private:
    Ui::PaintPoumian *ui;
    SegyThread *thread;
    PlotSettings settings;
    QString fileName;
    int freq;
    int acc;
    QPixmap pixmap;
    QRect rect;
    enum { Margin = 50 };
    QPointF mousePoint;
    bool isShiftPress;
    QList < QVector<QPointF> > list;
    int traceNum;
    int currentMinTrace;
    int currentMaxTrace;
     Segy *segy;
};

#endif // PAINTPOUMIAN_H
